package Ms.utils;

import java.util.Random;

public class PasswordUtil {

    // 生成临时密码的方法
    public static String generateTempPassword() {
        // 定义临时密码的字符集，包括数字、大写字母和小写字母
        String charset = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
        Random random = new Random();
        StringBuilder password = new StringBuilder();

        // 生成8位临时密码
        for (int i = 0; i < 8; i++) {
            int index = random.nextInt(charset.length());
            password.append(charset.charAt(index));
        }

        return password.toString();
    }
}